UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mKHZ7BIY3gLaDBrGdlyFQ9YnWq4Tmk1FIvdKwOsqRPY=' 
WHERE 
  key_id = 'a79b6aeb4bde8ab36e414def8cc51029fd59dbde911c5b35176d265f63e57769' 
  AND (
    token = 'mKHZ7BIY3gLaDBrGdlyFQ9YnWq4Tmk1FIvdKwOsqRPY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016