UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yG7vgRmFcWIL52+87lqYYH8THg9BzJg/7fS2ej8PuT8=' 
WHERE 
  key_id = '894a2cab0b85b56093ad52e9a569bf87815217c8fb41ea6a16335f155e9b57c5' 
  AND (
    token = 'yG7vgRmFcWIL52+87lqYYH8THg9BzJg/7fS2ej8PuT8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050