UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DCb7a5/8IYxyQPfOcTvQxeNAubnEAtfDo//Vi0YogfU=' 
WHERE 
  key_id = '1cd65814e9086fe975754875ea9efd5ad241657ab212eb01bf3a022b5caf9056' 
  AND (
    token = 'DCb7a5/8IYxyQPfOcTvQxeNAubnEAtfDo//Vi0YogfU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035