UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ssc22liynzoe0GIJHnd7gBJrCWw1pDX0Sf0ugJTyj+w=' 
WHERE 
  key_id = '5077283fdefe815e5bf9ccd96ac599975ce80f6ecb2b3033fbe84b6b40c5336f' 
  AND (
    token = 'ssc22liynzoe0GIJHnd7gBJrCWw1pDX0Sf0ugJTyj+w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027