UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YlELjvsldwLosolhUd7iCQYVnjgAEfkowvzQlDWv4+I=' 
WHERE 
  key_id = '3c8b6bd08e27ecd819e23c56e088f847ad90462c0b9444143e42d7b8a6ca0c74' 
  AND (
    token = 'YlELjvsldwLosolhUd7iCQYVnjgAEfkowvzQlDWv4+I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048