UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8SQ5yioM6cE118q9awNKSYAsw0AkA9w6X9hCuPQ5Dg8=' 
WHERE 
  key_id = '116381d52e277638258904f39ae111aa2357568b118e517a1d7e749bd9e75d35' 
  AND (
    token = '8SQ5yioM6cE118q9awNKSYAsw0AkA9w6X9hCuPQ5Dg8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030