UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '30WkMZEh56q7dQlzFbwhDWoOd0/Ei0bodObKv8Ia3Ig=' 
WHERE 
  key_id = '8dd15e5fcb4fb486662ba1228af1371bf3e030b3262f12251046e0b4b4ea2f2b' 
  AND (
    token = '30WkMZEh56q7dQlzFbwhDWoOd0/Ei0bodObKv8Ia3Ig=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047