UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '/2I9GiZWQrJcqGMV+kclwAKXHQjtuOwGGkW6b5pBX00=' 
WHERE 
  key_id = '51fff7b2521add4dbda4214ffca4c8f09f6564bc2fe509be01cc961f798d169f' 
  AND (
    token = '/2I9GiZWQrJcqGMV+kclwAKXHQjtuOwGGkW6b5pBX00=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040