UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Iu5KYCQd83fw+RiV1gpXLxRAbq68l5VecODagiSvH0s=' 
WHERE 
  key_id = '7afc06d9200334e926d05e7f7a2501fd76978d36d90373f68959567723d224ef' 
  AND (
    token = 'Iu5KYCQd83fw+RiV1gpXLxRAbq68l5VecODagiSvH0s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047