UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'u0gf9M+M8PvGpt50ciVj77/XazA+xivwu/YT/tGop1s=' 
WHERE 
  key_id = '7f0aafe7c2a78da576340edbebfba48d38dde6e3650456e5c2fbe24e8c11b915' 
  AND (
    token = 'u0gf9M+M8PvGpt50ciVj77/XazA+xivwu/YT/tGop1s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021