UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MkSK2XVFddEqkhI6P1f2+MVHwEo59tqd/ACXGPqL670=' 
WHERE 
  key_id = '815196912b49b321466485765b9ed910ccb8db01f1df201181cc6536e4fe152b' 
  AND (
    token = 'MkSK2XVFddEqkhI6P1f2+MVHwEo59tqd/ACXGPqL670=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034