UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MCNhWvr37PsJH09qhkpLSow1sS6tj4Ur74wwmsGB4ro=' 
WHERE 
  key_id = '5ca436280b7327eccc71a4e719e81bc54b42e26401c0d0879b8d7217fee700b5' 
  AND (
    token = 'MCNhWvr37PsJH09qhkpLSow1sS6tj4Ur74wwmsGB4ro=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036