UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vLcK7FIXGz9WaBIyfx5HaqCz/sFXXAQp3ZHFvWwlNqQ=' 
WHERE 
  key_id = '2ba9d0a267a83bbb95ab080d12a38b00b2b61e643947de30df99681acd5f3917' 
  AND (
    token = 'vLcK7FIXGz9WaBIyfx5HaqCz/sFXXAQp3ZHFvWwlNqQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036