UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'EBbnBaKBATee5KNntcjwMewfzvkQ/LPlQbXHfc5UF9A=' 
WHERE 
  key_id = '7634b47d10254a750a5c1a9e1a871dd064a863a550d39cf6a954b780dc714142' 
  AND (
    token = 'EBbnBaKBATee5KNntcjwMewfzvkQ/LPlQbXHfc5UF9A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031