UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BUHrZaX6IBhVFLMg+Q+e7kKDcqv1aQJQeXv3V2lwcAY=' 
WHERE 
  key_id = '76d4cde026229880711465da610c324df0310085e795ea620b8150e54f63fdd7' 
  AND (
    token = 'BUHrZaX6IBhVFLMg+Q+e7kKDcqv1aQJQeXv3V2lwcAY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049