UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZGR81vCPnNGSeArb7ARI02cH+gUav3w/EuCQyHEOaX0=' 
WHERE 
  key_id = '0c66f91748399bab04edbaffc170ac7843b08c0a583373f5c845a004808c5330' 
  AND (
    token = 'ZGR81vCPnNGSeArb7ARI02cH+gUav3w/EuCQyHEOaX0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032