UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'eYoPprF/LDHtjNH2ZCyOqrqsSasYQ4pa7c7ceP8v0zA=' 
WHERE 
  key_id = '3a4d313e7555b7e861a715d1e301372432ddf76ff5f614190cec8b38731eba41' 
  AND (
    token = 'eYoPprF/LDHtjNH2ZCyOqrqsSasYQ4pa7c7ceP8v0zA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040