UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ryrhO/FraVviXqNZDauxrTDvd2Tf2fNIEUBnIxGS95Q=' 
WHERE 
  key_id = '6877713a5dd31a8a8960b6b45e92ed40c8a4215ad697c3542d132346924f9c6d' 
  AND (
    token = 'ryrhO/FraVviXqNZDauxrTDvd2Tf2fNIEUBnIxGS95Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016