UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7Acu+LS986vZ68SltaY2ZaKLqcuQJYGe1cXM+Jx5vuk=' 
WHERE 
  key_id = '56f44711dc7cd26389a29cb3a331d12204cd8166db7a6460c97a8ef6f12313d6' 
  AND (
    token = '7Acu+LS986vZ68SltaY2ZaKLqcuQJYGe1cXM+Jx5vuk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047