UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3HrHnM+6VxWhY3zhjoxaySGfenM0TsYsjBquscUhp8A=' 
WHERE 
  key_id = '01497919710189fafbc08816fed1c53a24389b273b998820622204fc2ed80434' 
  AND (
    token = '3HrHnM+6VxWhY3zhjoxaySGfenM0TsYsjBquscUhp8A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033