UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KUfljjCn0kB47cMvkiPptWAAKQ275Pk+LNVTRCzasVk=' 
WHERE 
  key_id = '117554e0e8049f404e43651ec19156134987004c99a1a95128e9620cf22cb88e' 
  AND (
    token = 'KUfljjCn0kB47cMvkiPptWAAKQ275Pk+LNVTRCzasVk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035