UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'j9i4BnZMJ860EIVnMT4OuzIZP+SYFaRzTQjqCGV5+kM=' 
WHERE 
  key_id = 'b95a69d216903d485edaf9c7e93651fddeca34361384f994876f9cbe6f460607' 
  AND (
    token = 'j9i4BnZMJ860EIVnMT4OuzIZP+SYFaRzTQjqCGV5+kM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036