UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bUTrRHbltqibs6RNsNXpNqb33DKwBcWYivQnC3lgX9w=' 
WHERE 
  key_id = '60b13555c7043debbace24b7a234375d780e4676a5439512a868f6981a869f1d' 
  AND (
    token = 'bUTrRHbltqibs6RNsNXpNqb33DKwBcWYivQnC3lgX9w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052