UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bIFrJ4zEj4X6HzldAO0RwVzmJV8ObpisJd9MdOXtlCI=' 
WHERE 
  key_id = '562b7c1173ad925bfbfaee0a9f4aec70a485dadf7dc1bd45efd1087030997271' 
  AND (
    token = 'bIFrJ4zEj4X6HzldAO0RwVzmJV8ObpisJd9MdOXtlCI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026