UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Bx4Ne2gF5xt6h64iaPL6KxrKtT6tGyQbv4NBXhO58wg=' 
WHERE 
  key_id = '8fa91fd439b1967e51aa7194b10c6e56049bd84dfabcb4d9cd198df817f6fcbe' 
  AND (
    token = 'Bx4Ne2gF5xt6h64iaPL6KxrKtT6tGyQbv4NBXhO58wg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048