UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FfCuL1Kby8iJiWRGLey0DKnk2Nr2CQuqed+BO24qzWI=' 
WHERE 
  key_id = '7040753100ef4c60dd953672fca9efbf55e3ff26f5b402a238dd81dd1fd2ca4a' 
  AND (
    token = 'FfCuL1Kby8iJiWRGLey0DKnk2Nr2CQuqed+BO24qzWI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026