UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '740Rg6R+/uJNLcKqi8GIieT1Ovt36kOKB8WNqf1xutE=' 
WHERE 
  key_id = 'a4149356fede9ba0154d249b4adf3c8dc438ec95dc7da821e9eee7b438277a51' 
  AND (
    token = '740Rg6R+/uJNLcKqi8GIieT1Ovt36kOKB8WNqf1xutE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049