UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sZw/lhmQUUG5jnQFSa9RWzhfbNiHrM30J7C5dWnF6Sg=' 
WHERE 
  key_id = 'b162ba47acb38aa39f253064f350a5e5f5c047a777d150705cfc5b1a434b5478' 
  AND (
    token = 'sZw/lhmQUUG5jnQFSa9RWzhfbNiHrM30J7C5dWnF6Sg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047