UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DbIxFcwNdErpwlMcAsfRrktwos0ce+m/dzjSVmIfwRc=' 
WHERE 
  key_id = '59050d3b309ffe5febd1d36c009a0f37b95b48841b9269ffc7b931cf818f4f1c' 
  AND (
    token = 'DbIxFcwNdErpwlMcAsfRrktwos0ce+m/dzjSVmIfwRc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042