UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 't3/gV7XQ0kQmK8JGhZUS/38ghuGlnhwuLtfoKXiW8Tw=' 
WHERE 
  key_id = '1cebe0def10f6903b12fdb7de889d4f8e9776ea3b25abed354c02b282d99435d' 
  AND (
    token = 't3/gV7XQ0kQmK8JGhZUS/38ghuGlnhwuLtfoKXiW8Tw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027