UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4Wygp59LtuvrpPpKajm16vlRaefh6QC+rZqnH793LHw=' 
WHERE 
  key_id = '134c3cbc4c7e496ace7a1851943a77e27f246e4a12cac8a9bde1d16fa0a0a92e' 
  AND (
    token = '4Wygp59LtuvrpPpKajm16vlRaefh6QC+rZqnH793LHw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052